import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick.Controls.Styles 1.0
import "../controls"
import "../pages"

Item {
    id:r_o_o_t
    property int getting_width: 800
    property int getting_height: 480
    property bool delVis: false
    signal sendTextLine(string msg)
    width: getting_width
    height: getting_height
    ListView
    {
        add: Transition {
            NumberAnimation { properties: "x,y"; from: 100; duration: 200 }
        }
        displaced: Transition {
            NumberAnimation { properties: "x,y"; duration: 200 }
        }
        id:list
        x:1
        height: 472
        width: 508
        model: I_model
        delegate:
            Rectangle
        {
        id:dlg
        color:"#696969"
        width: getting_width-_numBoard.width-5
        height: 41
        Rectangle
        {
            color:"white"
            height: 1
            width: parent.width
        }
        Row{
            anchors.fill: parent
            Image {
                id: pic
                width: 36
                height: 36
                source: "http://media.blizzard.com/wow/icons/36/"+icon+".jpg"
                anchors.verticalCenter: parent.verticalCenter
            }
            Text
            {
                anchors.verticalCenter: parent.verticalCenter
                color: "#303030"
                text: "  "+id
                font.pointSize: 11
                verticalAlignment: Text.AlignVCenter
            }
            Text
            {
                color: "#eee1e1"
                anchors.verticalCenter: parent.verticalCenter
                text: name
                font.pointSize: 14
                verticalAlignment: Text.AlignVCenter
            }
            Text
            {
                x:dlg.width-20
                color: "#6f0d31"
                anchors.verticalCenter: parent.verticalCenter
                text: " | X | "
                font.pointSize: 10
                verticalAlignment: Text.AlignVCenter
                visible: delVis
                enabled:  delVis
                MouseArea
                {
                    anchors.fill: parent
                    onClicked:
                    {
                        console.log(index)
                        I_model.remRow(index)
                    }
                }
            }
        }
    }
}
Rectangle
{
    color:"grey"
    width: _numBoard.width
    height: (getting_height-_numBoard.height)/2
    anchors.right: parent.right
    anchors.rightMargin: 3
    anchors.bottom: _numBoard.top
    anchors.bottomMargin: 1
}
Item
{
    id: _numBoard
    width: 150
    height: numBoard.cH
    anchors.verticalCenter: parent.verticalCenter
    anchors.right: parent.right
    anchors.rightMargin: 3
    CR_numBoard
    {
        id:numBoard
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.verticalCenter: parent.verticalCenter
        function addItem(_s)
        {
            I_model.addRow(_s)
        }
    }
}
Rectangle
{
    color:"grey"
    width: _numBoard.width
    height: (getting_height-_numBoard.height)/2
    anchors.right: parent.right
    anchors.rightMargin: 3
    anchors.top: _numBoard.bottom
    Rectangle
    {
        id: b01
        y:25
        width: 100
        height: 30
        color: numBoard.b1c1
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.verticalCenter: parent.verticalCenter
        Text
        {
            anchors.fill: parent
            text: "save"
            font.pointSize: 15
            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
            color:numBoard.b1c2
        }
        MouseArea
        {
            anchors.fill: parent
            hoverEnabled: true
            onClicked:
            {
                click_anim_h.start()
                click_anim_w.start()
            }
        }
        SequentialAnimation{
            id: click_anim_h
            NumberAnimation
            {
                from: b01.height
                to:  b01.height+10
                properties:"height"
                duration: 100
                target:b01
            }
            NumberAnimation
            {
                from: b01.height+10
                to:  b01.height
                properties: "height"
                duration: 100
                target:b01
            }
        }
        SequentialAnimation{
            id: click_anim_w
            NumberAnimation
            {
                from: b01.width
                to:  b01.width+10
                properties: "width"
                duration: 100
                target:b01
            }
            NumberAnimation
            {
                from: b01.width+10
                to:  b01.width
                properties: "width"
                duration: 100
                target:b01
            }
        }
    }
}
}
